package com.ayit.car.service.impl;

import com.ayit.car.common.result.PageResult;
import com.ayit.car.pojo.dto.AnnouncementPageQueryDTO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ayit.car.pojo.Announcements;
import com.ayit.car.service.AnnouncementsService;
import com.ayit.car.mapper.AnnouncementsMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 为王下葬
* @description 针对表【announcements(公告表)】的数据库操作Service实现
* @createDate 2024-06-24 18:11:40
*/
@Service
public class AnnouncementsServiceImpl extends ServiceImpl<AnnouncementsMapper, Announcements>
    implements AnnouncementsService{

    @Autowired
    private AnnouncementsMapper announcementMapper;

    @Override
    public PageResult getPage(AnnouncementPageQueryDTO announcementPageQueryDTO) {

        PageHelper.startPage(announcementPageQueryDTO.getPage(), announcementPageQueryDTO.getPageSize());
        Page<Announcements> page = announcementMapper.getPage(announcementPageQueryDTO);
        return new PageResult(page.getTotal(), page.getResult());
    }
}




